package com.androidx.p013lv.mine.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.mine.C1207R;

/* renamed from: com.androidx.lv.mine.adapter.MineBuyVideoAdapter */
public class MineBuyVideoAdapter extends BaseRecyclerAdapter<VideoBean, Holder> {
    private String domain;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((VideoBean) getDataInPosition(i));
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C1207R.C1212layout.item_mine_buy_video, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.androidx.lv.mine.adapter.MineBuyVideoAdapter$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView img_select;
        ImageView iv_cover;
        ImageView iv_original = ((ImageView) this.itemView.findViewById(C1207R.C1210id.iv_original));
        ImageView iv_pay = ((ImageView) this.itemView.findViewById(C1207R.C1210id.iv_pay));
        ImageView iv_vip = ((ImageView) this.itemView.findViewById(C1207R.C1210id.iv_vip));
        RelativeLayout root_view;
        TextView tv_lease_tag;
        TextView tv_num;
        TextView tv_score;
        TextView tv_time;
        TextView tv_title;

        Holder(View view) {
            super(view);
            this.root_view = (RelativeLayout) view.findViewById(C1207R.C1210id.root_view);
            this.iv_cover = (ImageView) view.findViewById(C1207R.C1210id.iv_cover);
            this.img_select = (ImageView) view.findViewById(C1207R.C1210id.img_select);
            this.tv_score = (TextView) view.findViewById(C1207R.C1210id.tv_score);
            this.tv_time = (TextView) view.findViewById(C1207R.C1210id.tv_time);
            this.tv_title = (TextView) view.findViewById(C1207R.C1210id.tv_title);
            this.tv_num = (TextView) view.findViewById(C1207R.C1210id.tv_num);
            this.tv_lease_tag = (TextView) view.findViewById(C1207R.C1210id.tv_lease_tag);
        }

        /* access modifiers changed from: package-private */
        public void setData(VideoBean videoBean) {
            if (videoBean.getEditState() == 0) {
                this.root_view.setPadding(UiUtils.dp2px(4), 0, 0, 0);
                this.img_select.setVisibility(8);
            } else if (videoBean.getEditState() == 1) {
                this.root_view.setPadding(UiUtils.dp2px(10), 0, UiUtils.dp2px(-8), 0);
                this.img_select.setImageResource(C1207R.C1209drawable.mine_btn_edit_un_select);
                this.img_select.setVisibility(0);
            } else {
                this.root_view.setPadding(UiUtils.dp2px(10), 0, UiUtils.dp2px(-8), 0);
                this.img_select.setImageResource(C1207R.C1209drawable.mine_btn_edit_select);
                this.img_select.setVisibility(0);
            }
            if (videoBean.getCoverImg() == null || videoBean.getCoverImg().size() <= 0 || TextUtils.isEmpty(videoBean.getCoverImg().get(0))) {
                GlideUtils.loadCropRadiusDefault(4, this.iv_cover);
            } else {
                GlideUtils.loadCropRadius(MineBuyVideoAdapter.this.domain + videoBean.getCoverImg().get(0), 4, this.iv_cover);
            }
            TextView textView = this.tv_score;
            textView.setText(videoBean.getScore() + "分");
            this.tv_time.setText(TimeUtils.stringForTime(videoBean.getPlayTime() * 1000));
            this.tv_title.setText(videoBean.getTitle());
            this.iv_vip.setVisibility(8);
            this.iv_pay.setVisibility(8);
            if (videoBean.getVideoType() == 1) {
                this.iv_vip.setVisibility(0);
            } else if (videoBean.getVideoType() == 2) {
                this.iv_pay.setVisibility(0);
            }
            if (videoBean.isSelfMade()) {
                this.iv_original.setVisibility(0);
            } else {
                this.iv_original.setVisibility(8);
            }
            if (videoBean.getBuyType() == 3) {
                this.tv_lease_tag.setVisibility(0);
                TextView textView2 = this.tv_num;
                textView2.setText("到期：" + TimeUtils.utcToChinaTwo(videoBean.getLeaseExpAt()));
                return;
            }
            this.tv_lease_tag.setVisibility(8);
            TextView textView3 = this.tv_num;
            textView3.setText("播放：" + UiUtils.num2str(videoBean.getFakeWatchNum()) + "人");
        }
    }
}
